"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_request_interceptors = require("./interceptors.js");
function setupRequest() {
  common_vendor.index.$u.http.setConfig((defaultConfig) => {
    defaultConfig.baseURL = "/api";
    return defaultConfig;
  });
  utils_request_interceptors.requestInterceptors();
  utils_request_interceptors.responseInterceptors();
}
function request(config) {
  return new Promise((resolve) => {
    common_vendor.index.$u.http.request(config).then((res) => {
      const { result } = res;
      resolve(result);
    });
  });
}
function get(config) {
  return request({ ...config, method: "GET" });
}
function post(config) {
  return request({ ...config, method: "POST" });
}
exports.get = get;
exports.post = post;
exports.setupRequest = setupRequest;
